package com.tree.rw.demo.mapper;

import com.tree.rw.demo.annotation.Master;
import com.tree.rw.demo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @ClassName com.tree.rw.demo.mapper
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 2019-06-02 15:07
 * @Version 1.0
 */
@Mapper
public interface UserMapper {

    @Select("SELECT * FROM user")
    List<User> getAll();

    @Select("SELECT * FROM user WHERE id = #{id}")
    User getById(@Param("id") Integer id);

    @Master
    @Insert("INSERT INTO user(id, name,age,email,create_time) VALUES(#{id}, #{name}, #{age}, #{email}, now())")
    int insert(User user);





}
